package com.wc.alorithm_luogu.P3741;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/23 12:36
 * @description https://www.luogu.com.cn/problem/P3741
 * honoka的键盘
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());

        String word = sc.nextLine();
        char[] chs = word.toCharArray();
        char preLetter = chs[0];

        // 连续一样的字母个数
        int num = 1;
        char K = 'K';
        char V = 'V';

        // 是否有KK VV 单独存在
        boolean flgKKorVV = false;
        // 存放答案
        int ans = 0;

        // 一共分4种情况 KK VV KV VK
        for (int i = 1; i < n; i++) {
            if (chs[i] == V) {
                // KV 时候
                if (preLetter == K) {
                    if (num >= 2) {
                        flgKKorVV = true;
                    }
                    num = 1;
                    // VV时候
                } else {
                    num++;
                }
            } else {
                // VK 时候
                if (preLetter == V) {
                    if (num - 1 >= 2) {
                        flgKKorVV = true;
                    }
                    ans++;
                    num = 0;
                    // KK 时候
                } else {
                    num++;
                }
            }
            preLetter = chs[i];
        }
        if (num >= 2) {
            flgKKorVV = true;
        }

        if (flgKKorVV) {
            ans++;
        }
        System.out.println(ans);
    }
}
